package com.meme.editor.level.define;

import java.util.Hashtable;
import java.util.List;
import java.util.Vector;

import com.meme.editor.level.Actor;
import com.meme.editor.level.Appearance;
import com.meme.editor.level.AppearanceFactory;

public class AppearanceDefine 
{
	String mName;
	String mType;
	
	Vector <Parameter> mParameters;
//	List<PropertyDefineBlock> mPropertyGroupDefines = new Vector<PropertyDefineBlock> ();
	
	public AppearanceDefine (String name, String type)
	{
		mName = name;
		mType = type;
	}
	
	public String getName ()
	{
		return mName;
	}
	
	public String getType ()
	{
		return mType;
	}
	
	public void addParamters (List<Parameter> paramList)
	{
		if (mParameters == null)
			mParameters = new Vector<Parameter> ();
		
		mParameters.addAll (paramList);
		
	}
	
	public List<Parameter> getParameters ()
	{
		return mParameters;
	}
	
//	public void addPropertyDefines (List<PropertyDefineBlock> propertyGroupDefines)
//	{
//		mPropertyGroupDefines.addAll (propertyGroupDefines);
//	}
	
//	public Appearance createAppearanceInstanceFor (Actor actor)
//	{
//		Appearance appearance = new Appearance (actor);
//
//		
//		for (Parameter param : mParameters)
//		{
//			appearance.setParameter (param.getName(), param.getStringValue());
//		}
//
//		return null;
//	}
	
	public void makeInstanceForActor (Actor actor)
	{
		Appearance appearance = AppearanceFactory.createAppearance (getType ());
		appearance.setName (getName());
		actor.attachAppearance (appearance);
		
		for (Parameter parameter : getParameters())
		{
			appearance.setParameter(parameter.getName(), parameter.getStringValue());
		}
	}
}
